import types from "../actionTypes"
const state = {
  dictList:{},
  currentFile:{}, // 当前文件
  svModes:[], // 二次验证列表
  cacheRoutes:[], // keep-alive
  originData:'', // 原始加密数据
  dllgJson:{}, // 大连理工json
}

const mutations = {
  [types.SET_DLLGJSON](state,dllgJson){
    state.dllgJson = dllgJson;
  },
  [types.SET_ORIGIN_DATA](state,originData){
    state.originData = originData;
  },
  [types.SET_DICTLIST](state,dictList){
    state.dictList = dictList;
  },
  [types.SET_CURRENT_FILE](state, currentFile){
    state.currentFile = currentFile;
  },
  [types.SET_SVMODEL](state, svModes){
    state.svModes = svModes;
  },
  [types.SET_CACHE_ROUTES](state,routeName){
    if(!state.cacheRoutes.includes(routeName)){
      state.cacheRoutes.push(routeName);
    }
  },
  [types.REMOVE_CACHE_ROUTES](state,routeName){
    let index = state.cacheRoutes.indexOf(routeName);
    if(index !== -1){
      state.cacheRoutes.splice(index,1);
    }
  },
}

const actions = {
}

export default {
  namespaced: true,
  state,
  mutations,
  actions
}
